<script type="text/javascript">
    $(document).ready(function() {
        $('#carouselDCAB').carousel({
            interval: 5000
        });
    });


</script>

<?php
//optaining count and carousel from carousel controller
$count = $this->requestAction('carousels/count');
$carousels = $this->requestAction('carousels/show');
?>

<!-- Carousel 
================================================ -->
<br>
<div id="carouselDCAB" class="carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
        <?php
        for ($i = 0; $i < $count; $i++) {
            if ($i == 0) {
                //setting first object to be active
                echo '<li data-target="#carouselDCAB" data-slide-to=' . $i . ' class="active"></li>';
            } else {
                echo '<li data-target="#carouselDCAB" data-slide-to=' . $i . '></li>';
            }
        }
        echo '</ol>'; //close ol
        echo '<div class="carousel-inner">';

        $c = 0;

        foreach ($carousels as $carousel):

            if ($c == 0) {
                //set first item as active
                echo '<div class="item active">';
            } else {
                echo '<div class="item">';
            }
            echo $this->Html->image('carousel/' . $carousel['Carousel']['src'], array('width' => '800px', 'height' => '300px', 'class'=>'carousel-image', 'url'=>$carousel['Carousel']['link']));

            echo '</div>'; //close <div class='item'>
            $c++;
        endforeach;
        echo '</div>'; //<close <div class=carousel-inner>
        ?>  

</div>  <!--/Carousel -->

